Data compression is used for reducing the cost of storing large image files. It is also used for reducing the time of transmitting large image files.
Certain techniques are good for compressing certain types of images, but not others. A compression technique such as palettization provides good bit rates for lossless compression of images having only a small number of colors. However, palettization is not practical for images having large numbers of colors. In some instances, palettization can increase file size due to the cost of palette description. In contrast, a lossless compression technique such as JPEG-LS provides good bit rates for photos and other natural images. However, the potential of JPEG-LS is not fully exploited if portions of an image contain only a few dissimilar colors, as in the case of compound documents (which contain both text and natural images).
According to one aspect of the present invention, a plurality of color caches corresponding to different chromatic contexts are accessed, a color cache for a pixel value being processed is selected, and information in the selected color cache is used to predict a value for the pixel being processed.
According to a second aspect of the present invention, an error is determined between a predicted value and an actual value of a pixel being processed, the error is encoded if the error satisfies a constraint, and default is made to a backup technique to code the pixel being processed if the error does not satisfy the constraint.
According to a third aspect of the present invention, a cache is generated of pixel values already processed, the cache is used to predict a value of a pixel being processed, and a pixel value is added to the cache if the actual value of the pixel being processed is not found in the cache.
Other aspects and advantages of the present invention will become apparent from the following detailed description, taken in conjunction with the accompanying drawings, illustrating by way of example the principles of the invention.